package com.zhangmeng.callBack;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.zhangmeng.handler.HandlerApi;

import java.io.BufferedWriter;
import java.io.IOException;
import java.net.Socket;

/**
 * @author zm
 * @date 2025/2/22 11:54
 * @version: 1.0
 */
public class HandlerApiCallBack implements HandlerApi {

    private final Log log = LogFactory.get();

    @Override
    public void handle(BufferedWriter writer,  byte[] data) {
        log.info("HandlerApiCallBack handle data:" + new String(data));
        try {
            writer.write(new String(data));
            writer.flush();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
